# Contributor: Pavel Pletenev <cpp.create@gmail.com>
# Maintainer: Pavel Pletenev <cpp.create@gmail.com>
pkgname=cryfs
pkgver=0.10.2
pkgrel=0
pkgdesc="Cryptographic filesystem for the cloud"
url="https://github.com/cryfs/cryfs"
# Fails on other arches
arch="x86_64 aarch64"
license="LGPL-3.0-only"
depends="fuse"
makedepends="cmake attr-dev curl-dev fuse-dev linux-headers
	boost-dev python3"
source="$pkgname-$pkgver.tar.gz::https://github.com/cryfs/cryfs/archive/$pkgver.tar.gz
	0001-fix-for-python3.patch"

prepare() {
	default_prepare
	echo "$pkgver" > VERSION
}

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	export GIT_CEILING_DIRECTORIES="$srcdir"
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_TESTING=ON \
		-DBoost_USE_STATIC_LIBS=OFF \
		$CMAKE_CROSSOPTS .
	make -C build -j1
}

check() {
	./build/test/gitversion/gitversion-test
	./build/test/cpp-utils/cpp-utils-test
	./build/test/parallelaccessstore/parallelaccessstore-test
	./build/test/blockstore/blockstore-test
	./build/test/blobstore/blobstore-test
	./build/test/cryfs/cryfs-test
}

package() {
	make -C build PREFIX=/usr DESTDIR="$pkgdir" install
}

sha512sums="e9bd890eacbd60cef402fdfb3389eaf394c8e762a550563d720ede9badbea0fabebe14879f8d26e8e621ff635800d6901c67f99a52101d7c0c63499942694306  cryfs-0.10.2.tar.gz
d299466c8cfaa0f1f75565756d95a12cd7fa94615f0292f31ad0494dc8a0aae35c22fbab023d7e183b95e877c58553a0c8f8ab1f7444df1f9d1b292c063edfb0  0001-fix-for-python3.patch"
